<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="lib/react.js"></script>
    <script src="lib/react-dom.js"></script>
    <script src="lib/browser.js"></script>
</head>
<body>
    <div id="root"></div>

    <script type="text/babel">
    
    function formName(user) {
        return user.firstName + ' ' + user.lastName;
    }

    const user = {
        firstName : "尼古拉斯",
        lastName : "赵四"
    }


    function getGreeting(user){
        if(user){
            return <h1>hello :  { formName(user) } </h1>
        }else{
            return <h1>hello stranger</h1>
        }

    }


    // const ele = (
    //    <div>
    //         <h1> hello,{formName(user)} </h1>
    //         <h1> hello,{ 1 + 1 } </h1> 
    //         <h1> hello,{ 2 > 3 ? "hello" : "world" } </h1> 
    //    </div>
    // )
    let h = getGreeting(user);


    ReactDOM.render(h,document.getElementById("root"))
    
    </script>
</body>
</html>